import path from 'path'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import VueDevTools from 'vite-plugin-vue-devtools'
import pxtovw from 'postcss-px-to-viewport'

// for mobile view
const usePxtovw = pxtovw({
  viewportWidth: 375,
  viewportUnit: 'vw'
}) 

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    //VueDevTools(),
  ],
  server: {
    port: 5173,
    host: true,
    //open: true,
  },
  build: { chunkSizeWarningLimit: 1000, },
  resolve: {
    // https://cn.vitejs.dev/config/#resolve-alias
    alias: {
      '~': path.resolve(__dirname, './'),
      '@': path.resolve(__dirname, './src')
    },
    // https://cn.vitejs.dev/config/#resolve-extensions
    extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
  },
  css: {
    postcss: {
      plugins: [usePxtovw]
    }
  },
})
